import cv2 as cv
import numpy as np


def nothing_call(self):
    pass


src = cv.imread('lena.jpg')
cols,rows = src.shape[:2]
cv.namedWindow('image',cv.WINDOW_AUTOSIZE)
cv.createTrackbar('Zoom','image',0,5,nothing_call)
while True:
    cv.imshow('image',src)
    key = cv.waitKey(1)
    if key == 27:
        break
    r = cv.getTrackbarPos('Zoom','image')
    if r == 0:
        src = cv.resize(src,(cols,rows),fx=0,fy=0,interpolation=cv.INTER_LINEAR)
    else:
        src = cv.resize(src,(cols*(r+1),rows*(r+1)),fx=0,fy=0,interpolation=cv.INTER_LINEAR)
cv.destroyAllWindows()
